import axios from '@/api'

export interface IDocument {
  power_id: string;
  power_desc: string;
}

class HelpServices {
  constructor() { }

  /**
   * 查看文档
   *
   * @returns
   * @memberof HelpServices
   */
  async getDocument(data: Pick<IDocument, 'power_id'>) {
    return axios.post<unknown, Api.ResponseOptions<IDocument>>('/btsys/pub/get-help', data)
  }

  /**
   * 修改文档内容
   *
   * @param {IDocument} data
   * @returns
   * @memberof HelpServices
   */
  async updateDocument(data: IDocument) {
    return axios.post<unknown, Api.ResponseListOptions>('/btsys/help/set-help', data)
  }

  /**
   * 更新微信图片
   *
   * @param {File} image
   * @returns
   * @memberof HelpServices
   */
  async setWx(image: File) {
    const formdata = new FormData()
    formdata.append('img', image)
    return axios.post<unknown, Api.ResponseListOptions>('/bthelp/wx/set-wx-img', formdata)
  }


  /**
   * 获取微信图片
   *
   * @returns
   * @memberof HelpServices
   */
  async getWx() {
    return axios.post<unknown, Api.ResponseListOptions>('/bthelp/wx/get-wx-img')
  }
}

export const helpServices = new HelpServices()

export default HelpServices
